package ZiXi;

import java.util.ArrayList;
import java.util.Random;

public class TestTram {
    public static void main(String[] args) {
        ArrayList<Tram> list=new ArrayList<>();
        //创建车对象
      Tram che1=new Tram("刘德华",25,0);
      Tram che2=new Tram("缆车",132,0);
      Tram che3=new Tram("铁蛋车",5646,0);
      list.add(che1);
      list.add(che2);
      list.add(che3);
        Singer stu1 = new Singer("刘德华",25,"打篮球");
        
        for (int i = 0; i < list.size(); i++) {
            Tram che=list.get(i);
            Random k=new Random();
            che.setJuli(k.nextInt(2001));
        }
        boolean jk=true;
        for (int i = 0; i < list.size(); i++) {
            Tram lie=list.get(i);
            if(lie.getJuli()<1000){
                System.out.println(lie.getBrand()+"--"+lie.getPrice()+"--"+lie.getJuli());
                jk=false;
            }
        }
        if(jk){
            System.out.println("没有行驶距离在1000以下的电车");
        }


    }
}
